<template>
  <div class="recom-detail">
    <div class="top-img"> <img :src="article.articleCover"
           alt=""></div>
    <div class="article-box">
      <div class="article-cont">
        <!-- 文章标题 -->
        <h2 class="artile-title">{{article.articleTitle}}</h2>
        <!-- 文章内容 -->
        <div class="article-text"
             v-html="article.articleContent">
        </div>
        <!-- 文章作者 -->
        <div class="article-author">——by {{article.author}}</div>
      </div>
    </div>
  </div>
</template>

<script>
import { detailArticle } from '@/api/article'
export default {
  data() {
    return {
      article: {}
    }
  },
  methods: {
    async initDeatil() {
      let { data: res } = await detailArticle(this.$route.query.articleId)
      console.log(res.data)
      this.article = res.data
    }
  },
  created() {
    console.log(this.$route.query.articleId)
    this.initDeatil()
  }
}
</script>

<style lang="less" scoped>
.recom-detail {
  /* 文章内容 */
  .top-img {
    height: 350px;
    overflow: hidden;
    img {
      width: 100%;
    }
  }
  .article-box {
    position: relative;
    margin: 0 auto;
    width: 1000px;

    .article-cont {
      position: absolute;
      top: -70px;
      left: 0;
      width: 100%;
      min-height: 300px;
      /* 标题 */
      .artile-title {
        text-align: center;
        height: 70px;
        line-height: 70px;
        letter-spacing: 1px;
        box-shadow: 0 0 3px #ccc;
        border-radius: 12px 12px 0 0;
        background-color: rgba(255, 255, 255, 0.9);
      }
      /* 内容 */
      ::v-deep .article-text {
        margin: 20px auto;
        width: 800px;
        min-height: 300px;
        text-indent: 2em;
        line-height: 30px;
        letter-spacing: 1px;
        overflow: hidden;
        p {
          img {
            display: none;
          }
        }
      }
      .article-author {
        margin: 20px auto 40px auto;
        width: 800px;
        text-align: right;
        font-weight: 600;
      }
    }
  }
}
</style>